package com.epic;

public class TableTransfrom {
    public static void main(String[] args) {
        // 对于tmp avro的 hdfs文件转换到 parquet的文件
        /*
        These hints give users a way to tune performance and control the number of output files in Spark SQL.
        主要使用了Spark sql hint的功能 指定输出到hdfs的文件个数，便于文件管理
        // REPARTITION Dataset hint
        spark.table("src").join (spark.table("records").hint ("REPARTITION", 10), "a").show()

// Spark SQL REPARTITION hint
        spark.sql("SELECT /*+ REPARTITION(10,s.a)  * / * FROM records r JOIN src s ON r.a = s.a").show()

        https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-hints.html

        insert into /*+ REPARTITION(3) *\/ table t partition(ns_date='date=20180801', ns_hour='hour=24') \
        select * from tmp_t where date='date=20180802' and hour<'2350' and hour>='2300'
        alter table tmp_t drop partition (date='20181102');
         */

    }
}
